package com.itheima.Controller;

import com.itheima.Service.InventoryService;
import com.itheima.pojo.Inventory;
import com.itheima.pojo.Result;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@Slf4j
@RequestMapping("/api/inventory")
public class InventoryController {
    @Autowired
    private InventoryService inventoryService;
    @GetMapping
    private Result getInventories(){
        log.info("调用查询所有库存接口");
        List<Inventory> inventoryList = inventoryService.getInventories();
        return Result.success(inventoryList);
    }
}
